<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <div id="btn1">wowowo</div>
    <a id="link1" href="https://www.baidu.com/?tn=62095104_10_oem_dg"></a>
</body>
<script>
    var btn =document.getElementById('btn1')
    btn.addEventListener('click', function(event) {
        console.log('clicked')
    })

    function bindEvent(elem, type, fn) {
        elem.addEventListener(type, fn)
    }
    var a = document.getElementById('link1')
    bindEvent(a, 'click', function(e) {
        e.preventDefault(); //阻止默认行为
        alert('clicked')
    })
</script>
</html>